package com.zhangck.bos2_0.action.system;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.zhangck.bos2_0.Service.system.PermissionServices;
import com.zhangck.bos2_0.common.BaseAction;

import cn.itcast.bos.domain.system.Permission;

/** 
* @author 上午茶
* @version 创建时间：2018年6月18日 下午8:37:17 
* 类说明 
*/
@ParentPackage("json-default")
@Namespace("/")
@Scope("prototype")
@Actions
@Controller
public class PermissionAction  extends BaseAction<Permission>{

	@Autowired
	private PermissionServices permissionSerivce;
	
	@Action(value="permission_list",results={@Result(name="success",type="json")})
	public String permission_list(){
		  List<Permission> list = permissionSerivce.findAll();
		
		  ActionContext.getContext().getValueStack().push(list);
		return "success";
	}
	
	
	
	@Action(value="permission_add", results = { @Result(name = "success", type = "redirect",location="/pages/system/permission.html") })
	public String permission_add(){
		permissionSerivce.save(model);
		return "success";
	}
}
